<?php
defined('SYSPATH') OR die('No direct access allowed.');
/**
 * category.php
 * @author ranuandra
 *
 * 25 Jun 2012 09:24:56
 *
 * 
 */

class Model_Category extends ORM
{
	
	protected $_belongs_to = array(
						'user' => array('model'  =>  'user')
	);
	
	protected $_has_many = array(
							'content'	=> array('model' => 'content')
						);
	
	private $_field = array('category', 'flag_published');
	private $_form = array('category' => '', 'flag_published'=>'');
	
	public $rules = array(
					'category' => array(
									array('min_length', array(':value', 0)),
								),
					'flag_published' => array(
									array('min_length', array(':value', 0)),
								),

	);
	
	public function getField()
	{
		return $this->_field;
	}
	
	public function getForm()
	{
		return $this->_form;
		
	}
	
	public function create_data($values)
	{
	    return $this->values($values, $this->_field)->create();
	}
}